package com.example.wwj.service;

import com.example.wwj.mapper.CourseMapper;
import com.example.wwj.mapper.CurriculumMapper;
import com.example.wwj.pojo.Course;
import com.example.wwj.pojo.Curriculum;
import com.example.wwj.pojo.Student;
import com.example.wwj.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CurriculumService {

    @Autowired
    private CourseMapper courseMapper;

    @Autowired
    private CurriculumMapper curriculumMapper;

    public List<Course> courseList() {
        return courseMapper.courseList();
    }


    public List<Curriculum> curriculumList() {
        return curriculumMapper.findAll();
    }

    public List<Curriculum> findCurriculumByTeacherId(Integer teacher_id) {
        return curriculumMapper.findCurriculumById(teacher_id);
    }


    public List<Course> getCourseById(Integer course_id) {
        return courseMapper.getCourseById(course_id);
    }

    public List<Curriculum> selectPage(Integer pageNum, Integer pageSize, Integer class_id, Integer grade_id, String teacher_name) {
        return curriculumMapper.selectPage(pageNum,pageSize,class_id,grade_id,teacher_name);
    }

    public Integer selectTotal(Integer class_id,Integer grade_id,String teacher_name) {
        return curriculumMapper.selectTotal(class_id,grade_id,teacher_name);
    }

    public int deleteById(List<Integer> ids){
        Map<String, Object> map = new HashMap<>();
        map.put("ids", ids);
        return curriculumMapper.deleteCurriculumByIds(map);
    }
}
